var oldtabClr=ct.clrSession.getTabValue(tab,"tabClr" );
if(oldtabClr)
{
tabClr = oldtabClr;
}
else
{
clrSat = ct.clrRand(ct.satmin,ct.satmax); //for keeping saturation to match the old static template we need the saturation between 30 and 95;ideally could be min 30; add advanced prefs later
clrLum = ct.clrRand(ct.lummin,ct.lummax); //for keeping saturation to match the old static template we need the luminance between 68 and 78
var showCtCtx = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).getBoolPref("extensions.clrtabs.menu").toString();
if(!showCtCtx) return;
if(ct.scheme == 1) //If the menu option has been turned on
{
//add the element
var clrMenu2a = document.createElement("menuitem");
var clrSat = ct.clrRand(ct.satmin,ct.satmax); //for keeping saturation to match the old static template we need the saturation between 30 and 95;ideally could be min 30; add advanced prefs later
var clrLum = ct.clrRand(ct.lummin,ct.lummax); //for keeping saturation to match the old static template we need the luminance between 68 and 78
//7641001910403507
//12646680001161
var randkey = parseInt(Math.random()*100000000000000).toString(); //generate a really random int
var tabClr ='hsl('+Math.abs(ct.clrHash(randkey))%360+','+clrSat+'%,'+clrLum+'%)';
var oldtabClr=ct.clrSession.getTabValue(tab,"tabClr" );
if(oldtabClr)
{
tabClr = oldtabClr;
}
else
{
clrSat = ct.clrRand(ct.satmin,ct.satmax); //for keeping saturation to match the old static template we need the saturation between 30 and 95;ideally could be min 30; add advanced prefs later
clrLum = ct.clrRand(ct.lummin,ct.lummax); //for keeping saturation to match the old static template we need the luminance between 68 and 78
dump("\nctlog:\terror in function ct.setTaBottomClr "+e);
}
},
setSeamonkeyContainerBg:function(yes)
{
var clrPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).getCharPref("extensions.clrtabs.bgpicpath");
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.clrtabs.");
var host = tab.linkedBrowser.contentDocument.location.host;
var url = tab.linkedBrowser.contentDocument.location;
var testWWW = /^www\.(.+\..+)$/.exec(host);
//tabClr = 'hsl('+Math.abs(ct.clrHash(host))%360+','+60+'%,'+73+'%)'; //use fixed values for sat and lum for host. to do - will use userprefs later for them -
var colored = 0;
if(ct.enabledomain)
{
for (i=0;i<ct.dpref.length;i++)
{
if(host.match(ct.dpref[i].split("~")[0]))
{
tabClr = ct.dpref[i].split("~")[1];
colored = 1;//set the flag that the domain got a color
}
}
if(colored == 0) //if the domain didn't get a match, (preference - color unmatched domains)generate a default color?